package com.shijunhao.graduation.controller;


import com.shijunhao.graduation.domain.bean.HotInfoKey;
import com.shijunhao.graduation.domain.bean.ResultCode;
import com.shijunhao.graduation.domain.entity.BusinessHotInfo;
import com.shijunhao.graduation.domain.vo.PieCulVo;
import com.shijunhao.graduation.service.business.IBusinessHotInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author shijunhao
 * @since 2022-04-10
 */
@RestController
@RequestMapping("/business-hot-info")
@Api(tags = "热度统计")
public class BusinessHotInfoController {
    @Resource
    private IBusinessHotInfoService hotInfoService;


    @GetMapping("/note/gender")
    @ApiOperation("发文男女占比")
    public ResultCode<List<PieCulVo>> noteGenderVo(){
        return ResultCode.success(hotInfoService.noteGenderInfo());
    }

    @GetMapping("/note/age")
    @ApiOperation("发文年龄占比")
    public ResultCode<List<PieCulVo>> noteAgeVo(){
        return ResultCode.success(hotInfoService.noteAgeInfo());
    }

    @GetMapping("/note/{id}")
    @ApiOperation("文章热度详情")
    public ResultCode<BusinessHotInfo> info(@PathVariable Long id){
        return ResultCode.success(hotInfoService.getById(id));
    }

}
